//
//  BaseViewController.m
//  ZhiHuDaily
//
//  Created by albert on 16/8/28.
//  Copyright © 2016年 albert. All rights reserved.
//

#import "BaseViewController.h"

@interface BaseViewController ()<UITableViewDataSource, UITableViewDelegate, UIGestureRecognizerDelegate>

@end

@implementation BaseViewController

- (UITableView *)tableView{
    if (!_tableView) {
        self.automaticallyAdjustsScrollViewInsets = NO;
        UITableView *tableView = [[UITableView alloc] init];
        tableView.frame = CGRectMake(0, JKNavBarHeight, self.view.width, self.view.height - JKNavBarHeight);
        tableView.backgroundColor = [UIColor clearColor];
        tableView.rowHeight = 100;
        tableView.dataSource = self;
        tableView.delegate = self;
        
        [self.view insertSubview:tableView belowSubview:self.navBarView];
        _tableView = tableView;
    }
    return _tableView;
}

- (NavBarView *)navBarView{
    if (!_navBarView) {
        NavBarView *navBarView = [NavBarView barViewWithTitle:nil showBackTitle:NO];
        __weak typeof(self) weakSelf = self;
        [navBarView setBackBtnClickBlock:^(UIButton *btn) {
            [weakSelf.navigationController popViewControllerAnimated:YES];
        }];
        [self.view addSubview:navBarView];
        _navBarView = navBarView;
    }
    return _navBarView;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.automaticallyAdjustsScrollViewInsets = NO;
    
    [self tableView];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 0;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    return nil;
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
